<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript">
        var arr = [0,1,2, 3, 4, 5, 6, 7, 8, 9, 10];
        var rewith = ["a", "b", "c"];
        var tmp1 = arr.splice(2, 5, rewith);
        with(document){
            writArr1("替换了5个数据",tmp1);
            writArr1("替换为：", rewith);
            writArr1("替换后", arr);
            document.write(arr + "<br/>");
            document.write(arr.length + "<br/>");
            for(var i=0 ;i<arr.length;i++) {
                document.write(arr[i] + "<br/>");
            }

            var tmp2 = arr.splice(5, 2);
            writArr1("删除2个数据", tmp2);
            writArr1("替换后", arr);
        }

        function writArr1(str,array) {
            document.write(str + ":");
            document.write(array.join(","));
            document.write("<br/>");
        }
        document.write("<br/>===================")
        var arr2 = [0,1,"a","b","c",7,8,9,10];
        var tmp3 = arr2.splice(5, 2);
        document.write(tmp3);
        writArr1("改变后", arr2);

    </script>
</head>
<body>

</body>
</html>